/**
 * main页面引入js和css
 *
 * @author tanghom<tanghom@qq.com> 2016/4/28
 */
var webPath = getRootPath();
// webPath += "/baiding";//无项目名设为空
importDoc(webPath + '/vendor/pace/theme.css');
importDoc(webPath + '/vendor/bootstrap/css/bootstrap.min.css');
importDoc(webPath + '/vendor/font-awesome/css/font-awesome.min.css');
importDoc(webPath + '/css/animate.min.css');
importDoc(webPath + '/css/main.css');
importDoc(webPath + '/css/palette.css');
importDoc(webPath + '/vendor/jquery.min.js');
importDoc(webPath + '/vendor/jquery-extends.js');
importDoc(webPath + '/vendor/bootstrap/js/bootstrap.js');
importDoc(webPath + '/vendor/jquery.placeholder.js');
importDoc(webPath + '/vendor/jquery.slimscroll.js');
importDoc(webPath + '/vendor/modernizr.js');
importDoc(webPath + '/vendor/jquery-art-dialog/art_dialog.js');
importDoc(webPath + '/js/function.js');



//函数可以单独引入一个js或者css
function importDoc(url) {
    var file = url;
    //以任意开头但是以.js结尾正则表达式
    if (file.match(/.*\.js$/)) {
        document.write('<script type="text/javascript" src="' + file + '"></script>');
    }
    else if (file.match(/.*\.css$/)) {
        document.write('<link rel="stylesheet" href="' + file + '" type="text/css" />');
    }
}
//js获取项目根路径
function getRootPath(){
    //获取当前网址
    var curWwwPath=window.document.location.href;
    //获取主机地址之后的目录
    var pathName=window.document.location.pathname;
    var pos=curWwwPath.indexOf(pathName);
    //获取主机地址，
    var localhostPath=curWwwPath.substring(0,pos);
    return(localhostPath);
}

